<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 李邦琦 <1536549251@qq.com>
// +----------------------------------------------------------------------

namespace app\crm\controller;
use think\Loader;
use think\Cache;

class Target extends CrmController
{
    /**
     * userDailyTarget
     */
    public function userDailyTarget()
    {
        $menuname = "User Daily Target";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname];     
        $this->assign("priv",$priv);
        // 模板输出
        return $this->fetch('userDailyTarget');
    }


    /**
     * userMonthlyTarget
     */
    public function userMonthlyTarget()
    {
        $menuname = "User Monthly Target";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname];     
        $this->assign("priv",$priv);
        // 模板输出
        return $this->fetch('userMonthlyTarget');
    }


    public function userDailyData ()
    {
        $arrData = Loader::model('Target')->userDailyData();
        echo json_encode($arrData);
    }


    public function userMonthlyData ()
    {
        $arrData = Loader::model('Target')->userMonthlyData();
        echo json_encode($arrData);
    }


    public function delDailyTarget () 
    {
        Loader::model('Target')->delDailyTarget($_REQUEST['id']);
    }


    public function delMonthlyTarget () 
    {
        Loader::model('Target')->delMonthlyTarget($_REQUEST['id']);
    }

}